/*
 * (C) Copyright 2016 Ymatou (http://www.ymatou.com/).
 * 
 * All rights reserved.
 */
package com.ymatou.iapi.trading.operate.parameter;

import java.math.BigDecimal;
import java.util.List;

/**
 *
 */
public class PlaceOrderResp {

	/**
	 *
	 * 下单时生成的订单
	 */
	private List<Order> orderList;

	/**
	 *
	 * 下单时生成的交易号
	 */
	private int tradingId;
	/**
	 *
	 * 下单总支付金额
	 */
	private BigDecimal payAmount;

	/**
	 *
	 * 买家用户id
	 */
	private int userId;

	/**
	 *
	 * 砍价团单号
	 */
	private String bizId;

	/**
	 *
	 * 改交易所有订单总支付的运费
	 */
	//private BigDecimal freight;

	public BigDecimal getFreight() {

		return orderList.stream().map(item -> item.getFreight())
				.reduce(BigDecimal.ZERO, BigDecimal::add);

	}

	/*	public void setFreight(BigDecimal freight) {
			this.freight = freight;

		}*/

	public int getTradingId() {
		return tradingId;
	}

	/**
	 * 
	 * @return 主单号
	 */
	public int getMainOrderId() {
		return tradingId;
	}

	public void setTradingId(int tradingId) {
		this.tradingId = tradingId;
	}

	public BigDecimal getPayAmount() {
		return payAmount;
	}

	public void setPayAmount(BigDecimal payAmount) {
		this.payAmount = payAmount;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getBizId() {
		return bizId;
	}

	public void setBizId(String bizId) {
		this.bizId = bizId;
	}

	public List<Order> getOrderList() {
		return orderList;
	}

	public void setOrderList(List<Order> orderList) {
		this.orderList = orderList;
	}

}
